Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 3 - Printer Drivers / The QuickDraw GX ImageWriter II Printer Driver Messages


Establishing the Preferred Printing Characteristics

QuickDraw GX sends the GXDefaultJob message to initialize a new job object. You can override this message, which is described on page 4-47 in the chapter "Printing Messages," to add collections to the job or to establish printing preferences for the job.

The ImageWriter II printer driver overrides the GXDefaultJob message to add an item to the job collection that stores the preferred printing resolution and to initialize that preference to the highest resolution possible. This message override, the SD_DefaultJob function, is shown in Listing 3-6.

Listing 3-6 Establishing the printing resolution for the ImageWriter II printer

OSErr SD_DefaultJob()
{
   OSErr anErr;
   
   anErr = Forward_GXDefaultJob();
   if (anErr == noErr)
      {
      long  imagewriterOptions = kSuperRes;
      /* add high resolution preference item */
      anErr = AddCollectionItem(GXGetJobCollection(GXGetJob()), 
               DriverCreator, 0, sizeof(imagewriterOptions), 
               &imagewriterOptions);
      }
   return(anErr);
} 
The SD_DefaultJob function adds an item to the job collection. Other printer drivers override the GXDefaultJob message for similar purposes. For example, one vector printer driver overrides this message to create a number of collection items that are used in its other functions. These items, which are added to the job collection, include the current carousel list, pen list, pens dialog box settings, and plot-quality settings.

When a user chooses the Page Setup dialog box, QuickDraw GX sends the GXJobDefaultFormatDialog message, which you can override to modify the contents of the dialog box. The ImageWriter II printer driver override of this message, SD_JobFormatDialog, determines if the job includes support for using the text-mode printing capabilities of the ImageWriter II, as shown in Listing 3-7. If the job does support text-mode printing, then text mode becomes the preferred printing mode. The GXJobDefaultFormatDialog message is described on page 4-82 in the chapter "Printing Messages."

Listing 3-7 Determining the preferred job-formatting mode

OSErr SD_JobFormatDialog(gxDialogResult   *theResult)
{
   OSErr                      anErr;
   gxJobFormatModeTableHdl    theJobFormatModeList;
   long                       i;
   gxJob                      theJob = GXGetJob();
   
   /* set up the job format mode information */
   
   anErr = GXGetAvailableJobFormatModes(&theJobFormatModeList);
   if ((!anErr) && (theJobFormatModeList))
      {
      for (i = 0; i <= (*theJobFormatModeList)->numModes - 1; ++i) 
         {
         if ((*theJobFormatModeList)->modes[i] ==
                                             gxTextJobFormatMode) 
            {
            GXSetPreferredJobFormatMode(gxTextJobFormatMode,
                                                      false);
            break;
            }
         }
      DisposHandle((Handle)theJobFormatModeList);
      }
      
   /*do normal dialogs after handling job format mode stuff */
   return(Forward_GXJobDefaultFormatDialog(theResult));
   
}
The SD_JobFormatDialog function calls the GXGetAvailableJobFormatModes function to determine which formatting modes the application supports. If text formatting mode is supported, SD_JobFormatDialog makes that the preferred 0mode by calling the GXSetPreferredJobFormatMode function. The GXGetAvailableJobFormatModes function is described on page 5-30 and the GXSetPreferredJobFormatMode function is described on page 5-30 in the chapter "Printing Functions for Message Overrides."


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help